package org.jpropelleralt.view;

import java.awt.Color;

import javax.swing.UIManager;

import org.jpropelleralt.view.update.UpdateManager;
import org.jpropelleralt.view.update.impl.UpdateManagerDefault;

/**
 * Access to global implementation of tools for {@link View}s 
 */
public class Views {

	private final static UpdateManager updateManager = new UpdateManagerDefault();

	/**
	 * Get the {@link UpdateManager}
	 * @return	The shared global {@link UpdateManager}
	 */
	public static UpdateManager updateManager() {
		return updateManager;
	}
	
	/**
	 * Initialise look and feel
	 */
	public static void initialiseLookAndFeel() {
    	try {            
            UIManager.setLookAndFeel(
                    "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
        } catch (Exception e) {
        	//Fall back to system look and feel if nimbus not available
        	try{
        		UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        	} catch (Exception e2) {
        	}
        }
	}

	/**
	 * Get the color used for a component background to indicate an error
	 * @return	Error background color.
	 */
	public static Color getErrorBackgroundColor() {
		return Color.pink;
	}

	/**
	 * Get column layout for a standard 3 column component (label, gap, component)
	 * @return	Column layout
	 */
	public static String getStandard3ColumnDefinition() {
		//Old form where components grow
		//"right:pref, $lcgap, min:grow"
		return "right:pref:grow, $lcgap, 200px";
	}
	
}
